package com.example.myapplication.pages;

import android.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import androidx.annotation.Nullable;

import com.example.myapplication.view_type.ListAdapter;
import com.example.myapplication.bean.Person;
import com.example.myapplication.dao.MySQLiteOpenHelper;
import com.example.myapplication.databinding.ActivityPage3Binding;
import com.example.myapplication.service.SharedPreferencesService;

import java.util.List;

/**
 * 3：分类查询师生界面
 */
public class page_3 extends Fragment {

    private ActivityPage3Binding page3Binding;

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {
        page3Binding = ActivityPage3Binding.inflate(inflater,container,false);
        Integer userId = (Integer) SharedPreferencesService.getUserInfo(getContext()).get("userId");
        List<Person> personList = new MySQLiteOpenHelper(getContext()).queryPersonByCondition(5,null,3, userId);

        page3Binding = ActivityPage3Binding.inflate(getLayoutInflater());

        ListAdapter listAdapter = new ListAdapter(personList, getContext());
        page3Binding.relation3.setAdapter(listAdapter);
        return page3Binding.getRoot();
    }
}